package com.molichuxing.services.property;

/**
 * 商品编号专属01 订阅02
 * @author xuelin yi
 */
public enum GoodsCodeEnum {

  EXCLUSIVE(1, "01"),SUBSCRIBE(2, "02");

  int value;
  String name;

  GoodsCodeEnum(int value, String name) {
    this.value = value;
    this.name = name;
  }

  public int getValue() {
    return value;
  }

  public String getName() {
    return name;
  }

  /**
   * 通过value获取枚举的name
   * @param value
   * @return
   */
  public static GoodsCodeEnum getName(int value) {
    for (GoodsCodeEnum orderSource : GoodsCodeEnum.values()) {
      if (orderSource.getValue() == value) {
        return orderSource;
      }
    }
    return null;
  }
}
